<template>
  <el-card header="系统通知">
    <el-table :data="dataList" border>
      <el-table-column prop="content" show-overflow-tooltip label="内容" align="center"/>
      <el-table-column prop="createTime" label="发布时间" align="center"/>
    </el-table>
    <el-pagination hide-on-single-page :current-page="pageInfo.page" :page-size="pageInfo.limit" :page-sizes="[5,10,20,50,100]" @current-change="currentChange" @size-change="sizeChange" layout="total,sizes,prev,pager,next,jumper" :total="pageInfo.total"/>
  </el-card>
</template>
<script>

export default {
  name: 'NoticePage',
  data () {
    return {
      dataList: [],
      pageInfo: {
        page: 1,
        limit: 5,
        total: 0
      }
    }
  },
  methods: {
    currentChange (val) {
      this.pageInfo.page = val
      this.getDataList()
    },
    sizeChange (val) {
      this.pageInfo.limit = val
      this.getDataList()
    },
    getDataList () {
      this.$http.get('api/v1/notice/page', { ...this.searchForm, ...this.pageInfo }).then(data => {
        if (data) {
          this.dataList = [...data.records]
          this.pageInfo.total = data.total
        }
      }).catch(() => {})
    }
  },
  created () {
    this.getDataList()
  }
}
</script>

<style scoped>

</style>
